﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CrazyClient
{
    /// <summary>
    /// Interaction logic for OutRider.xaml
    /// </summary>
    public partial class ViewerWindow : Window
    {
        public ViewerWindow()
        {
            InitializeComponent();
        }

       
        public void Maximize(string screenName)
        {
            try
            {
                foreach (System.Windows.Forms.Screen sc in System.Windows.Forms.Screen.AllScreens)
                {
                    if (sc.DeviceName == screenName)
                    {
                        this.WindowStartupLocation = WindowStartupLocation.Manual;
                        System.Drawing.Rectangle workingArea = sc.WorkingArea;
                        this.Left = workingArea.Left;
                        this.Top = workingArea.Top;
                        this.Width = workingArea.Width;
                        this.Height = workingArea.Height;

                        this.WindowStyle = WindowStyle.None;

                        Maximized = true;
                        this.Topmost = true;
                    }
                }
            }
            catch (ApplicationException)
            {
                this.WindowStyle = WindowStyle.SingleBorderWindow;
                this.WindowState = WindowState.Normal;
            }
        }
        bool Maximized = false;
        private void viewer1_Loaded(object sender, RoutedEventArgs e)
        {
            if (Maximized)
            this.WindowState = WindowState.Maximized;
        }
       
        
    }
   
}
